#include <iostream>
#include <unordered_map>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>

struct User
{
    User(const std::string &ip, const uint16_t port, struct sockaddr_in addr)
        : _ip(ip), _port(port), _addr(addr)
    {
        
    }

    std::string _ip;
    uint16_t _port;
    sockaddr_in _addr;
};

class OnlineUsers
{
public:
    void AddUser(const std::string &name, const User &us)
    {
        users.insert(std::make_pair(name, us));
    }

    void DelUser(const std::string &name)
    {
        users.erase(name);
    }

    bool FidUser(const std::string &name)
    {
        return users.find(name) != users.end();
    }

    std::unordered_map<std::string, User> users;
};